package unit7.moveMethod;

/**
 * @author v_irlwang
 * @date 2021/3/12
 */
public class Example1 {

    private AccountType accountType;
    private int daysOverdrawn;

    double overdraftCharge() {
        if (accountType.isPremium()) {
            double result = 10;
            if (daysOverdrawn > 7) {
                result += (daysOverdrawn - 7) * 0.85;
                return result;
            }
        }
        return daysOverdrawn * 1.75;
    }

    double bankCharge() {
        double result = 4.5;
        if (daysOverdrawn > 0) {
            result += overdraftCharge();
        }
        return result;
    }

}

class AccountType {
    double overdraftCharge(int daysOverdrawn) {
        if (isPremium()) {
            double result = 10;
            if (daysOverdrawn > 7) {
                result += (daysOverdrawn - 7) * 0.85;
                return result;
            }
        }
        return daysOverdrawn * 1.75;
    }

    public boolean isPremium() {
        return true;
    }
}